package com.jack.vipmis.vip.card.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.jack.vipmis.common.entity.BaseEntity;
import com.jack.vipmis.vip.business.entity.Business;

/**
 * 优惠券管理
 * 
 * @author JackLiang
 * @date 2014-6-16
 * @version 1.0
 */
@Entity
@Table(name = "discount")
public class Discount extends BaseEntity<Long> {

	@Column(name = "disLogo")
	private String		disLogo;

	@Column(name = "disTitle")
	private String		disTitle;

	@ManyToOne(optional = true, fetch = FetchType.EAGER)
	@JoinColumn(name = "bsId")
	@NotFound(action = NotFoundAction.IGNORE)
	@JSONField(serialzeFeatures = SerializerFeature.DisableCircularReferenceDetect)
	private Business	business;

	@Column(name = "disType")
	private Integer		disType;					// 优惠券类型

	@Column
	private String		disImageContent;

	@Column
	private String		disConsume;				// 折扣详情

	@Column
	private String		disSpecialTips;			// 特殊提示

	@Column
	private String		disPrice;

	@Column
	private Long		disValidityTime;

	@Column
	private Integer		disDownLoadCount;			// 下载次数

	@Column(name = "create_time")
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date		createTime	= new Date();

	@Column(name = "BsdistanceX")
	private String		bsdistanceX;

	@Column(name = "BsdistanceY")
	private String		bsdistanceY;

	@Transient
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JSONField(serialize = false)
	private Date		validityTime;

	@Column(name = "is_show")
	private Boolean		show		= true;

	// setter getter
	public String getDisLogo() {
		return disLogo;
	}

	public void setDisLogo(String disLogo) {
		this.disLogo = disLogo;
	}

	public String getDisImageContent() {
		return disImageContent;
	}

	public void setDisImageContent(String disImageContent) {
		this.disImageContent = disImageContent;
	}

	public String getDisTitle() {
		return disTitle;
	}

	public void setDisTitle(String disTitle) {
		this.disTitle = disTitle;
	}

	public String getDisConsume() {
		return disConsume;
	}

	public void setDisConsume(String disConsume) {
		this.disConsume = disConsume;
	}

	public String getDisSpecialTips() {
		return disSpecialTips;
	}

	public void setDisSpecialTips(String disSpecialTips) {
		this.disSpecialTips = disSpecialTips;
	}

	public Integer getDisDownLoadCount() {
		return disDownLoadCount;
	}

	public void setDisDownLoadCount(Integer disDownLoadCount) {
		this.disDownLoadCount = disDownLoadCount;
	}

	public String getBsdistanceX() {
		return bsdistanceX;
	}

	public void setBsdistanceX(String bsdistanceX) {
		this.bsdistanceX = bsdistanceX;
	}

	public String getBsdistanceY() {
		return bsdistanceY;
	}

	public void setBsdistanceY(String bsdistanceY) {
		this.bsdistanceY = bsdistanceY;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Boolean getShow() {
		return show;
	}

	public void setShow(Boolean show) {
		this.show = show;
	}

	public Long getDisValidityTime() {
		return disValidityTime;
	}

	public void setDisValidityTime(Long disValidityTime) {
		this.disValidityTime = disValidityTime;
	}

	public Date getValidityTime() {
		return validityTime;
	}

	public void setValidityTime(Date validityTime) {
		this.validityTime = validityTime;
	}

	public Integer getDisType() {
		return disType;
	}

	public void setDisType(Integer disType) {
		this.disType = disType;
	}

	public Business getBusiness() {
		return business;
	}

	public void setBusiness(Business business) {
		this.business = business;
	}

	public String getDisPrice() {
		return disPrice;
	}

	public void setDisPrice(String disPrice) {
		this.disPrice = disPrice;
	}

}
